@extends('layouts.admin')
@section('title') @parent 培训管理 @stop
@section('page_title')@parent
培训管理
@show
@section('breadcrumb')@parent
{{ Breadcrumbs::render('promotion-index') }}
@show
@section('content')
<div class="box">
	<div class="box-header">
		<h3 class="box-title">培训管理</h3>
	</div>
	<div class="box-body table-responsive">
		@include('widgets.notification')
		<div class="pad"><button class="btn btn-primary pull-right" type="button" onclick="location.href='{{ route('admin.promotion.create') }}'"><i class="fa fa-plus"></i> 添加培训</button></div>
        <form class="frm" method="post">
		<table id="example2" class="table table-bordered table-hover">
			<thead>
				<tr>
					<th>ID</th>
					<th>名称</th>
					<th>主讲人</th>
					<th>截止时间</th>
					<th>开讲时间</th>
				   <th>操作</th>
				</tr>
			</thead>
			<tbody>
			@foreach($datas as $data)
				<tr>
					<td>{{  $data->id }}</td>
					<td>{{ $data->name }}</td>
					<td>{{ $data->speaker}}</td>
					<td>{{ $data->apply_end_time}}</td>
					<td>{{ $data->promotion_start_time }}</td>
					<td><a href="{{ route('admin.promotion.edit', $data->id) }}">&nbsp;&nbsp;<span class="glyphicon glyphicon-edit"></span></a> <a href="javascript:void(0)" id="d_{{ $data->id }}" class="btn-del">&nbsp;&nbsp;<span class="glyphicon glyphicon-remove danger"></span></a>&nbsp;&nbsp;<a href="{{ route('admin.join.index', $data->id) }}"><span aria-hidden="true" class="glyphicon glyphicon-user"></span></a></td>
				</tr>
			 @endforeach
			</tbody>
		</table>
		</form>
	</div>
</div>

@stop
@section('end') @parent
<script type="text/javascript">
$(function() {
		$(document).on('click', '.btn-del', function(){
			if(confirm("你确定要删除该活动么？"))
			{
					var $id = $(this).attr("id").split('_')[1];
					$('<input type="hidden" name="_method" value="DELETE" />').insertAfter(this);
					$('.frm').attr('action', "/admins/promotions/" + $id);
					$('.frm').submit();
			}
		})
});
</script>
@stop